import { defineManifest } from '@crxjs/vite-plugin'
import packageData from '../package.json' assert { type: 'json' }

const isDev = process.env.NODE_ENV == 'development'

export default defineManifest({
  name: `${packageData.displayName || packageData.name}${isDev ? ` ➡️ Dev` : ''}`,
  description: packageData.description,
  version: packageData.version,
  manifest_version: 3,
  icons: {
    16: 'img/logo.png',
    32: 'img/logo.png',
    48: 'img/logo.png',
    128: 'img/logo.png',
  },
  action: {
    default_popup: 'popup.html',
    default_icon: 'img/logo.png',
  },
  options_page: 'options.html',
  devtools_page: 'devtools.html',
  background: {
    service_worker: 'src/background/index.js',
    type: 'module',
  },
  content_scripts: [
    {
      matches: ["<all_urls>"],
      js: ['src/contentScript/index.js'],
    }
  ],
  web_accessible_resources: [
    {
      resources: ['js/forensic-v5.6.1.min.js','js/anura.request.js','js/beasurveytaker-ResearchDefenderUI.js','js/main.524773fb43a82d810eff.js','js/pureprofile-cleanid-v3.current.min.js','js/mark-main.js','js/mdforlives-UserValidation-Decode.js','js/forensic-v5.6.2.min.js','js/sampleeye-main.js','js/spectrumsurveys-allFile.min.js','js/bib&sample-rf2-main.js','js/inn-rd-756.js','js/ssisurveys-RVIDWrapperAjaxSSI9_2024_04.js','js/unimrktresponse-main.js','js/ups-learn.js','js/sago-main.js','js/eliteopinio-common_const.js','js/caaa730ed462680b3c3fc324ca591ac5.js','js/sc_review_lib_secured_v1-3.min.js','js/UserValidation-Decode.js','js/forensic-v5.5.0.min.js','js/main.c56cfd77cc1cff9e0a83.js','img/logo.png'],
      matches: ["<all_urls>"]
    },
  ],
  "declarative_net_request": {
    "rule_resources": []
  },
  host_permissions: ["<all_urls>"],
  permissions: ['sidePanel','storage','scripting','webNavigation','background',"activeTab","tabs","declarativeNetRequest", "declarativeNetRequestWithHostAccess"],
})
